package com.aliothservice.catfish.admin.data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;

import org.springframework.data.annotation.Id;

public class PlatformRealtimeInfo {
	
	public Map<String, Object> toMap() {
		Map<String, Object> map = new HashMap<String, Object>();
		
		map.put("id", this.getId());
		map.put("module", this.getModule());
		map.put("identifier", this.getIdentifier());
		if (null != this.getWarehouseName()) {
			map.put("warehouseName", this.getWarehouseName());
			map.put("warehouseLocation", this.getWarehouseLocation());
			map.put("warehouseContactName", this.getWarehouseContactName());
			map.put("warehouseContactPhoneNumber", this.getWarehouseContactPhoneNumber());
		}
		if (null != this.getVehicleLicensePlate()) {
			map.put("vehicleLicensePlate", this.getVehicleLicensePlate());
			map.put("vehicleLocation", this.getVehicleLocation());
			map.put("vehicleContactName", this.getVehicleContactName());
			map.put("vehicleContactPhoneNumber", this.getVehicleContactPhoneNumber());
		}
		if (null != this.getProductTitle()) {
			map.put("productTitle", this.getProductTitle());
			map.put("productOrigin", this.getProductOrigin());
			map.put("productContactName", this.getProductContactName());
			map.put("productContactPhoneNumber", this.getProductContactPhoneNumber());
		}
		if (null != this.getIndividualName()) {
			map.put("individualName", this.getIndividualName());
			map.put("individualLocation", this.getIndividualLocation());
			map.put("individualContactName", this.getIndividualContactName());
			map.put("individualContactPhoneNumber", this.getIndividualContactPhoneNumber());
		}
		if (null != this.getEnterpriseName()) {
			map.put("enterpriseName", this.getEnterpriseName());
			map.put("enterpriseLocation", this.getEnterpriseLocation());
			map.put("enterpriseContactName", this.getEnterpriseContactName());
			map.put("enterpriseContactPhoneNumber", this.getEnterpriseContactPhoneNumber());
		}
		if (null != this.getVehicleOrderNumber()) {
			map.put("vehicleOrderNumber", this.getVehicleOrderNumber());
			map.put("vehicleOrderLicensePlate", this.getVehicleOrderLicensePlate());
			map.put("vehicleOrderRoute", this.getVehicleOrderRoute());
			map.put("vehicleOrderBuyer", this.getVehicleOrderBuyer());
			map.put("vehicleOrderBuyerPhoneNumber", this.getVehicleOrderBuyerPhoneNumber());
		}
		if (null != this.getWarehouseOrderNumber()) {
			map.put("warehouseOrderNumber", this.getWarehouseOrderNumber());
			map.put("warehouseOrderName", this.getWarehouseOrderName());
			map.put("warehouseOrderVolume", this.getWarehouseOrderVolume());
			map.put("warehouseOrderBuyer", this.getWarehouseOrderBuyer());
			map.put("warehouseOrderBuyerPhoneNumber", this.getWarehouseOrderBuyerPhoneNumber());
		}
		if (null != this.getProductOrderNumber()) {
			map.put("productOrderNumber", this.getProductOrderNumber());
			map.put("productOrderTitle", this.getProductOrderTitle());
			map.put("productOrderVolume", this.getProductOrderVolume());
			map.put("productOrderBuyer", this.getProductOrderBuyer());
			map.put("productOrderBuyerPhoneNumber", this.getProductOrderBuyerPhoneNumber());
		}
		if (null != this.getContactName()) {
			map.put("contactName", this.getContactName());
			map.put("contactPhoneNumber", this.getContactPhoneNumber());
			if (null != this.getWarehouseName()) {
				map.put("warehouseName", this.getWarehouseName());
				map.put("warehouseLocation", this.getWarehouseLocation());
			}
			if (null != this.getVehicleLicensePlate()) {
				map.put("vehicleLicensePlate", this.getVehicleLicensePlate());
				map.put("vehicleLocation", this.getVehicleLocation());
			}
		}
		if (null != this.getAlertTemperature()) {
			map.put("alertTemperature", this.getAlertTemperature());
			map.put("alertLicensePlate", this.getAlertLicensePlate());
			map.put("alertLongitude", this.getAlertLongitude());
			map.put("alertLatitude", this.getAlertLatitude());
			map.put("alertTemperatureMin", this.getAlertTemperatureMin());
			map.put("alertTemperatureMax", this.getAlertTemperatureMax());
			map.put("alertEvent", this.getAlertEvent());
		}
		DateTimeFormatter fullFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss:SSS");
		map.put("creationDate", fullFormatter.format(this.getCreationDate()));
		
		return map;
	}
	
	public static final String MODULE_USER = "user";
	public static final String MODULE_SERVICE = "service";
	public static final String MODULE_ORDER = "order";
	public static final String MODULE_ALERT = "alert";
	
	public static final String IDENTIFIER_INDIVIDUAL = "individual";
	public static final String IDENTIFIER_ENTERPRISE = "enterprise";
	public static final String IDENTIFIER_VEHICLE = "vehicle";
	public static final String IDENTIFIER_WAREHOUSE = "warehouse";
	public static final String IDENTIFIER_PRODUCT = "product";
	public static final String IDENTIFIER_DEVICE = "device";
	
	public static final String ALERT_EVENT_ALARMED = "alarmed";
	public static final String ALERT_EVENT_ALARM_REMOVED = "alarm_removed";

	@Id
	private String id;
	
	private String module;
	private String identifier;
	
	// alert - vehicle
	private Integer alertTemperature;
	private String alertLicensePlate;
	private Double alertLongitude;
	private Double alertLatitude;
	private Integer alertTemperatureMin;
	private Integer alertTemperatureMax;
	private String alertEvent;
	
	// device
	private String contactName;
	private String contactPhoneNumber;
	
	// vehicle
	private String vehicleLicensePlate;
	private String vehicleLocation;
	private String vehicleContactName;
	private String vehicleContactPhoneNumber;
	
	// warehouse
	private String warehouseName;
	private String warehouseLocation;
	private String warehouseContactName;
	private String warehouseContactPhoneNumber;
	
	// product
	private String productTitle;
	private String productOrigin;
	private String productContactName;
	private String productContactPhoneNumber;
	
	// vehicle order
	private String vehicleOrderNumber;
	private String vehicleOrderLicensePlate;
	private String vehicleOrderRoute;
	private String vehicleOrderBuyer;
	private String vehicleOrderBuyerPhoneNumber;
	
	// warehouse order
	private String warehouseOrderNumber;
	private String warehouseOrderName;
	private String warehouseOrderVolume;
	private String warehouseOrderBuyer;
	private String warehouseOrderBuyerPhoneNumber;
	
	// product order
	private String productOrderNumber;
	private String productOrderTitle;
	private String productOrderVolume;
	private String productOrderBuyer;
	private String productOrderBuyerPhoneNumber;
	
	// individual
	private String individualName;
	private String individualLocation;
	private String individualContactName;
	private String individualContactPhoneNumber;
	
	// enterprise
	private String enterpriseName;
	private String enterpriseLocation;
	private String enterpriseContactName;
	private String enterpriseContactPhoneNumber;
	
	private LocalDateTime creationDate;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getModule() {
		return module;
	}

	public void setModule(String module) {
		this.module = module;
	}

	public String getIdentifier() {
		return identifier;
	}

	public void setIdentifier(String identifier) {
		this.identifier = identifier;
	}

	public LocalDateTime getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(LocalDateTime creationDate) {
		this.creationDate = creationDate;
	}

	public String getWarehouseName() {
		return warehouseName;
	}

	public void setWarehouseName(String warehouseName) {
		this.warehouseName = warehouseName;
	}

	public String getWarehouseLocation() {
		return warehouseLocation;
	}

	public void setWarehouseLocation(String warehouseLocation) {
		this.warehouseLocation = warehouseLocation;
	}

	public String getWarehouseContactName() {
		return warehouseContactName;
	}

	public void setWarehouseContactName(String warehouseContactName) {
		this.warehouseContactName = warehouseContactName;
	}

	public String getWarehouseContactPhoneNumber() {
		return warehouseContactPhoneNumber;
	}

	public void setWarehouseContactPhoneNumber(String warehouseContactPhoneNumber) {
		this.warehouseContactPhoneNumber = warehouseContactPhoneNumber;
	}

	public String getProductTitle() {
		return productTitle;
	}

	public void setProductTitle(String productTitle) {
		this.productTitle = productTitle;
	}

	public String getProductOrigin() {
		return productOrigin;
	}

	public void setProductOrigin(String productOrigin) {
		this.productOrigin = productOrigin;
	}

	public String getProductContactName() {
		return productContactName;
	}

	public void setProductContactName(String productContactName) {
		this.productContactName = productContactName;
	}

	public String getProductContactPhoneNumber() {
		return productContactPhoneNumber;
	}

	public void setProductContactPhoneNumber(String productContactPhoneNumber) {
		this.productContactPhoneNumber = productContactPhoneNumber;
	}

	public String getVehicleLicensePlate() {
		return vehicleLicensePlate;
	}

	public void setVehicleLicensePlate(String vehicleLicensePlate) {
		this.vehicleLicensePlate = vehicleLicensePlate;
	}

	public String getVehicleLocation() {
		return vehicleLocation;
	}

	public void setVehicleLocation(String vehicleLocation) {
		this.vehicleLocation = vehicleLocation;
	}

	public String getVehicleContactName() {
		return vehicleContactName;
	}

	public void setVehicleContactName(String vehicleContactName) {
		this.vehicleContactName = vehicleContactName;
	}

	public String getVehicleContactPhoneNumber() {
		return vehicleContactPhoneNumber;
	}

	public void setVehicleContactPhoneNumber(String vehicleContactPhoneNumber) {
		this.vehicleContactPhoneNumber = vehicleContactPhoneNumber;
	}

	public String getIndividualName() {
		return individualName;
	}

	public void setIndividualName(String individualName) {
		this.individualName = individualName;
	}

	public String getIndividualLocation() {
		return individualLocation;
	}

	public void setIndividualLocation(String individualLocation) {
		this.individualLocation = individualLocation;
	}

	public String getIndividualContactName() {
		return individualContactName;
	}

	public void setIndividualContactName(String individualContactName) {
		this.individualContactName = individualContactName;
	}

	public String getIndividualContactPhoneNumber() {
		return individualContactPhoneNumber;
	}

	public void setIndividualContactPhoneNumber(String individualContactPhoneNumber) {
		this.individualContactPhoneNumber = individualContactPhoneNumber;
	}

	public String getEnterpriseName() {
		return enterpriseName;
	}

	public void setEnterpriseName(String enterpriseName) {
		this.enterpriseName = enterpriseName;
	}

	public String getEnterpriseLocation() {
		return enterpriseLocation;
	}

	public void setEnterpriseLocation(String enterpriseLocation) {
		this.enterpriseLocation = enterpriseLocation;
	}

	public String getEnterpriseContactName() {
		return enterpriseContactName;
	}

	public void setEnterpriseContactName(String enterpriseContactName) {
		this.enterpriseContactName = enterpriseContactName;
	}

	public String getEnterpriseContactPhoneNumber() {
		return enterpriseContactPhoneNumber;
	}

	public void setEnterpriseContactPhoneNumber(String enterpriseContactPhoneNumber) {
		this.enterpriseContactPhoneNumber = enterpriseContactPhoneNumber;
	}

	public String getVehicleOrderNumber() {
		return vehicleOrderNumber;
	}

	public void setVehicleOrderNumber(String vehicleOrderNumber) {
		this.vehicleOrderNumber = vehicleOrderNumber;
	}

	public String getVehicleOrderLicensePlate() {
		return vehicleOrderLicensePlate;
	}

	public void setVehicleOrderLicensePlate(String vehicleOrderLicensePlate) {
		this.vehicleOrderLicensePlate = vehicleOrderLicensePlate;
	}

	public String getVehicleOrderRoute() {
		return vehicleOrderRoute;
	}

	public void setVehicleOrderRoute(String vehicleOrderRoute) {
		this.vehicleOrderRoute = vehicleOrderRoute;
	}

	public String getVehicleOrderBuyer() {
		return vehicleOrderBuyer;
	}

	public void setVehicleOrderBuyer(String vehicleOrderBuyer) {
		this.vehicleOrderBuyer = vehicleOrderBuyer;
	}

	public String getVehicleOrderBuyerPhoneNumber() {
		return vehicleOrderBuyerPhoneNumber;
	}

	public void setVehicleOrderBuyerPhoneNumber(String vehicleOrderBuyerPhoneNumber) {
		this.vehicleOrderBuyerPhoneNumber = vehicleOrderBuyerPhoneNumber;
	}

	public String getWarehouseOrderNumber() {
		return warehouseOrderNumber;
	}

	public void setWarehouseOrderNumber(String warehouseOrderNumber) {
		this.warehouseOrderNumber = warehouseOrderNumber;
	}

	public String getWarehouseOrderName() {
		return warehouseOrderName;
	}

	public void setWarehouseOrderName(String warehouseOrderName) {
		this.warehouseOrderName = warehouseOrderName;
	}

	public String getWarehouseOrderVolume() {
		return warehouseOrderVolume;
	}

	public void setWarehouseOrderVolume(String warehouseOrderVolume) {
		this.warehouseOrderVolume = warehouseOrderVolume;
	}

	public String getWarehouseOrderBuyer() {
		return warehouseOrderBuyer;
	}

	public void setWarehouseOrderBuyer(String warehouseOrderBuyer) {
		this.warehouseOrderBuyer = warehouseOrderBuyer;
	}

	public String getWarehouseOrderBuyerPhoneNumber() {
		return warehouseOrderBuyerPhoneNumber;
	}

	public void setWarehouseOrderBuyerPhoneNumber(String warehouseOrderBuyerPhoneNumber) {
		this.warehouseOrderBuyerPhoneNumber = warehouseOrderBuyerPhoneNumber;
	}

	public String getProductOrderNumber() {
		return productOrderNumber;
	}

	public void setProductOrderNumber(String productOrderNumber) {
		this.productOrderNumber = productOrderNumber;
	}

	public String getProductOrderTitle() {
		return productOrderTitle;
	}

	public void setProductOrderTitle(String productOrderTitle) {
		this.productOrderTitle = productOrderTitle;
	}

	public String getProductOrderVolume() {
		return productOrderVolume;
	}

	public void setProductOrderVolume(String productOrderVolume) {
		this.productOrderVolume = productOrderVolume;
	}

	public String getProductOrderBuyer() {
		return productOrderBuyer;
	}

	public void setProductOrderBuyer(String productOrderBuyer) {
		this.productOrderBuyer = productOrderBuyer;
	}

	public String getProductOrderBuyerPhoneNumber() {
		return productOrderBuyerPhoneNumber;
	}

	public void setProductOrderBuyerPhoneNumber(String productOrderBuyerPhoneNumber) {
		this.productOrderBuyerPhoneNumber = productOrderBuyerPhoneNumber;
	}

	public String getContactName() {
		return contactName;
	}

	public void setContactName(String contactName) {
		this.contactName = contactName;
	}

	public String getContactPhoneNumber() {
		return contactPhoneNumber;
	}

	public void setContactPhoneNumber(String contactPhoneNumber) {
		this.contactPhoneNumber = contactPhoneNumber;
	}

	public Integer getAlertTemperature() {
		return alertTemperature;
	}

	public void setAlertTemperature(Integer alertTemperature) {
		this.alertTemperature = alertTemperature;
	}

	public String getAlertLicensePlate() {
		return alertLicensePlate;
	}

	public void setAlertLicensePlate(String alertLicensePlate) {
		this.alertLicensePlate = alertLicensePlate;
	}

	public Double getAlertLongitude() {
		return alertLongitude;
	}

	public void setAlertLongitude(Double alertLongitude) {
		this.alertLongitude = alertLongitude;
	}

	public Double getAlertLatitude() {
		return alertLatitude;
	}

	public void setAlertLatitude(Double alertLatitude) {
		this.alertLatitude = alertLatitude;
	}

	public Integer getAlertTemperatureMin() {
		return alertTemperatureMin;
	}

	public void setAlertTemperatureMin(Integer alertTemperatureMin) {
		this.alertTemperatureMin = alertTemperatureMin;
	}

	public Integer getAlertTemperatureMax() {
		return alertTemperatureMax;
	}

	public void setAlertTemperatureMax(Integer alertTemperatureMax) {
		this.alertTemperatureMax = alertTemperatureMax;
	}

	public String getAlertEvent() {
		return alertEvent;
	}

	public void setAlertEvent(String alertEvent) {
		this.alertEvent = alertEvent;
	}

}
